import os
from typing import List

class Settings:
    # 环境配置
    ENVIRONMENT = os.getenv("ENVIRONMENT", "development")
    
    # CORS配置
    @property
    def CORS_ORIGINS(self) -> List[str]:
        if self.ENVIRONMENT == "production":
            # 生产环境只允许特定域名
            return [
                "https://yourdomain.com",
                "https://www.yourdomain.com",
                # 添加你的生产环境域名
            ]
        else:
            # 开发环境允许本地开发服务器
            return [
                "http://localhost:3000",
                "http://localhost:8080", 
                "http://localhost:5173",
                "http://127.0.0.1:3000",
                "http://127.0.0.1:8080",
                "http://127.0.0.1:5173",
                "*"  # 开发环境允许所有来源
            ]
    
    # 数据库配置
    DATABASE_URL = os.getenv("DATABASE_URL", "sqlite:///./trees.db")
    
    # API配置
    API_V1_STR = "/api/v1"
    PROJECT_NAME = "Forest Management API"

settings = Settings() 